package com.aiyige.page.publish.coursesingleprice.adapter;

import android.support.constraint.ConstraintLayout;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.aiyige.R;
import com.aiyige.page.publish.selectcourse.model.Course;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.LinkedList;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by zhuyakun on 2018/3/26.
 */

public class CourseSinglePriceAdapter extends BaseQuickAdapter<Course, CourseSinglePriceAdapter.ViewHolder> {


    public CourseSinglePriceAdapter() {
        super(R.layout.course_single_price_item, new LinkedList<Course>());
    }

    @Override
    protected void convert(ViewHolder helper, Course item) {
        helper.bindData(item);
    }


    public class ViewHolder extends BaseViewHolder {
        @BindView(R.id.titleTv)
        TextView titleTv;
        @BindView(R.id.totalPriceTv)
        TextView totalPriceTv;
        @BindView(R.id.totalCourseNumTv)
        TextView totalCourseNumTv;
        @BindView(R.id.totalPriceLayout)
        LinearLayout totalPriceLayout;
        @BindView(R.id.currencySymbolTv)
        TextView currencySymbolTv;
        @BindView(R.id.singlePriceTv)
        TextView singlePriceTv;
        @BindView(R.id.slashTv)
        TextView slashTv;
        @BindView(R.id.singlePriceLayout)
        RelativeLayout singlePriceLayout;
        @BindView(R.id.containerLayout)
        ConstraintLayout containerLayout;
        Course data;

        public ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }

        public void bindData(Course item) {
            data = item;
            totalPriceTv.setText(item.getTotalPrice());
            totalCourseNumTv.setText(item.getCourseNum());
            singlePriceTv.setText(item.getSinglePrice());
            titleTv.setText(item.getTitle());
        }
    }
}
